package com.example.stock.controller;

import com.example.stock.entity.eo.HistoryEo;
import com.example.stock.service.IHistoryService;
import com.example.stock.vo.HistoryUpdateForm;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/history")
@Slf4j
public class HistoryController {

    @Resource
    private IHistoryService historyService;

    @GetMapping("list")
    @ApiOperation("历史列表")
    public List<HistoryEo> list() {
        List<HistoryEo> ruleEos = historyService.list();
        return ruleEos;
    }

    @PostMapping("update")
    public Map update(@RequestBody @Validated HistoryUpdateForm form) {
        historyService.update(form);
        return new HashMap();
    }


}
